<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ page import="com.gouwudai.gobbs.pojo.TbbsMessage"%>
<%@ include file="../common/common.jsp" %>
<%@ include file="user_pass2.jsp" %>
<%
String takeUser = ParamUtils.getStringParameter(request,"takeUser");

%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=SYSTITLE%> - 写新的短消息</title>
<meta name="Keywords" content="<%=SYSMETAKEY%>" />
<meta name="Description" content="<%=SYSMETADESC%>" />
<%@ include file="../common/meta.inc" %>
<link rel="stylesheet" type="text/css" href="css/defaultStyle.css" >
</head>
<body>
<%@ include file="../common/waiting.inc" %>
<SCRIPT language="javascript">

setStatus('<%=SYSTITLE%> - 工具箱');
</SCRIPT>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/prototype.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/buffalo/buffalo.js"></script>
<script language="javascript">
var END_POINT="${pageContext.request.contextPath}/buffalo";
var buffalo = new Buffalo(END_POINT);
function doSubmit() {

	form = document.theform;
	
	if(!validateForm(form))
		return;
		
    var obj = {};
	obj[Buffalo.BOCLASS] = "java.util.HashMap";	
	
	obj.postFlag=getRadioValue("postFlag");
	obj.title=$F('title');	
	obj.content=$F('content');
	
	obj.sendUser="<%=LOGIN_ID%>";
	obj.takeUser=$F('takeUser');
	obj.opIp="<%=request.getRemoteAddr()%>";
	
	var retMsg = "发送成功！";
	if(obj.postFlag=="2")
		retMsg = "短消息已保存到草稿箱";
    buffalo.remoteCall("messageServiceAjaxService.doNewMessage",[obj], function(reply) {
        ajaxSubmit(reply.getResult(),retMsg,"close");
    });
}

function validateForm(form)
{
	if(!sl_check(form.title,"短消息标题",200,1)) return false;
	if(!sl_check(form.content,"短消息内容",2000,1)) return false;		
    return true;
}
</script>
<DIV class="line"></DIV>
<DIV class="list_table_0">
<%=HtmlConst.navMenuNoLink("我的工具箱")%>&gt;&gt;写新的短消息
</DIV>
<DIV class="line"></DIV>
<form name="theform" id="theform" method="post" action="" onSubmit="return validateForm(this);">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tab">
<tr class="tab2">
	<td width="100"><strong>收信人</strong></td>
	<td height="22"><input name="takeUser" type="text" id="takeUser" value="<%=takeUser %>" size="40" maxlength="50"  onkeydown="nextKeyPress(this);"/>
		<span class="asterisk">*</span>
	</td>
</tr>
<tr class="tab2">
	<td height="25"><strong>主题</strong></td>
	<td ><input name="title" type="text" id="title" size="40" maxlength="200"  onkeydown="nextKeyPress(this);"/>
		<span class="asterisk">*</span>
	</td>
</tr>
<tr class="tab2">
  <td height="12"><strong>内容</strong></td>
  <td><textarea name="content" cols="60" rows="8" id="content"></textarea></td>
</tr>
<tr class="tab2">
  <td height="12"><strong>发送方式</strong></td>
  <td>
	<input name="postFlag" id="postFlag" type="radio" value="0"/>直接发送
	&nbsp;&nbsp;
	<input name="postFlag" id="postFlag" type="radio" value="1" checked/>发送同时保存到发件箱
	&nbsp;&nbsp;
	<input name="postFlag" id="postFlag" type="radio" value="2" />暂不发送保存到草稿箱</td>
</tr>
<tr class="tab2">
	<td height="25">&nbsp;</td>
	<td>
		<input name="btnSubmit" type="button" class="btn" id="btnSubmit" value="确定提交" onclick="doSubmit();" />
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input name="btnBack" type="button" class="btn"  onClick="javascript:self.close();" value="关闭窗口"/>
		&nbsp;&nbsp;(Ctrl+Enter)
	</td>
</tr>
</table>
</form>
<%=COPYRIGHTFOOT%>
<%@ include file="../common/foot.inc"%>
</body>
</html>